A conventional flash memory, which is a type of non-volatile memory EEPROM, is provided in a NOR type and a NAND type. A NOR type flash memory in particular is used as a substitute memory for a ROM. In this flash memory, data rewriting is performed in units of predetermined areas (sectors, for example). The number of times rewriting can be performed in each area is limited. Therefore, a data storage (updating) method in which all areas are used as evenly as possible, without fixing areas in which rewriting occurs frequently and areas in which rewriting occurs rarely, has been proposed in Japanese unexamined patent application H6-124596 to extend the useful life of the flash memory as far as possible.
For example, record unit data (a database) described in XML (Extensible Markup Language) are updated in the following manner.
An XML description shown in FIG. 5 expresses record unit data constituted by the items “employee ID”, “name”, “section”, “sex”, and “age”, and a description sandwiched between two tags (reserved words) <employee id= . . . > and </employee> corresponds to a record. These data (this database) express an employee list such as the following.    Employee ID: 001    Name: Ichirou Sato    Section: General Affairs    Sex: Male (M)    Age: 25    Employee ID: 015    Name: Jirou Sato    Section: Personnel    Sex: Male (M)    Age: 29    Employee ID: 100    Name: Saburou Sato    Section: General Affairs    Sex: Male (M)    Age: 35
For example, when the section of the employee identified by “Employee ID: 015, Name: Jirou Sato” is modified from “Personnel” to “Accounting”, the data described in XML shown in FIG. 5 are modified as shown in FIG. 6. More specifically, <section>Personnel</section>, which is included in the description sandwiched between the reserved words <employee id=0015>, </employee>, is modified to <section>Accounting</section>. When data modification is performed in this manner on a flash memory, specific processing is executed as follows.
First, the parts of the sector in the description shown in FIG. 5 that are not to be modified (all parts other than “Personnel”) are copied to another sector and “Accounting” is added to the other sector so as to be sandwiched between the reserved words <section>, </section>. Next, the data corresponding to the description in the original sector shown in FIG. 5 are deleted. Thus, data corresponding to the description shown in FIG. 6 remain in the other sector of the flash memory. As a result, the data corresponding to the description shown in FIG. 5 are updated to the data corresponding to the description shown in FIG. 6. Note that reserved words such as <employee id= . . . > and </employee> are control character strings determined according to the XML format, and cannot usually be modified in a similar manner to other variable data. Patent Document 1: Japanese Unexamined Patent Application Publication H6-124596
However, in the conventional data updating method described above, even when data stored in a predetermined area (sector) are modified only partially, new data must be written (or copied) in relation to the entire predetermined area (sector) and all of the data in the predetermined area (sector) must be deleted. As a result, a comparatively large amount of time is required to update the data. Furthermore, when partial modification is performed in a flash memory, an entire predetermined area (sector), which is limited in the number of possible deletions, must invariably be deleted once. Consequently, the lifespan of the flash memory is shortened every time data are updated.